package app.util.image.action.morph
{
	import app.util.*;
	import app.util.image.*;
	import app.util.image.action.*;
	import app.util.image.calc.*;
	
	import flash.display.*;

	public class ErosionAction extends SEBasedAction
	{
		private var ret:BinaryBitmapData;
		
		public override function getDescription():String
		{
			return "Binary Erosion";
		}
		
		protected override function getFinalBitmapData():BitmapData
		{
			return this.ret.toBitmapData();
		}
		
		protected override function processBitmapDataByStep():Number
		{
			var src:BitmapData = Mediator.getCurrentBitmapData();
			var biSrc:BinaryBitmapData = MorphUtility.autoThreshold(src);
			this.ret = MorphUtility.doErosion(biSrc, se);
			
			return 1;	
		}		
	}
}